0001    //
0002    //  BigUInt Comparison.swift
0003    //  BigInt
0004    //
0005    //  Created by Károly Lőrentey on 2016-01-03.
0006    //  Copyright © 2016 Károly Lőrentey. All rights reserved.
0007    //
0008    
0009    import Foundation
0010    
0011    extension BigUInt: Comparable {
0012        //MARK: Comparison
0013        
0014        /// Compare `a` to `b` and return an `NSComparisonResult` indicating their order.
0015        ///
0016        /// - Complexity: O(count)
0017        @warn_unused_result
0018        public static func compare
BigUInt Comparison.swift:36
    return BigUInt.compare(a, b) == .OrderedSame
BigUInt Comparison.swift:44
    return BigUInt.compare(a, b) == .OrderedAscending
(a: BigUInt, _ b: BigUInt) -> NSComparisonResult { 0019 if a.count != b.count { return a.count > b.count ? .OrderedDescending : .OrderedAscending } 0020 for i in (0..<a.count).reverse() { 0021 let ad = a[i] 0022 let bd = b[i] 0023 if ad != bd { return ad > bd ? .OrderedDescending : .OrderedAscending } 0024 } 0025 return .OrderedSame 0026 } 0027 } 0028 0029 //MARK: Comparison 0030 0031 /// Return true iff `a` is equal to `b`. 0032 /// 0033 /// - Complexity: O(count) 0034 @warn_unused_result 0035 public func ==(a: BigUInt, b: BigUInt) -> Bool { 0036 return BigUInt.compare(a, b) == .OrderedSame 0037 } 0038 0039 /// Return true iff `a` is less than `b`. 0040 /// 0041 /// - Complexity: O(count) 0042 @warn_unused_result 0043 public func <(a: BigUInt, b: BigUInt) -> Bool { 0044 return BigUInt.compare(a, b) == .OrderedAscending 0045 } 0046 0047 extension BigUInt { 0048 /// Return true iff this integer is zero. 0049 /// 0050 /// - Complexity: O(1) 0051 var isZero
BigInt.swift:40
        self.negative = (abs.isZero ? false : negative)
BigInt.swift:211
    if a.abs.isZero { return a }
BigUInt GCD.swift:20
        if a.isZero || b.isZero { return BigUInt() }
BigUInt GCD.swift:20
        if a.isZero || b.isZero { return BigUInt() }
BigUInt GCD.swift:29
        while !x.isZero {
BigUInt GCD.swift:50
        while !r2.isZero {
BigUInt Radix Conversion.swift:108
            while !rest.isZero {
BigUInt Square Root.swift:19
    guard !value.isZero else { return BigUInt() }
: Bool { 0052 return count == 0 0053 } 0054 } 0055 0056